package com.lintcode.solution;

import java.util.LinkedList;

public class Solution_40 {
    public static void main(String[] agrs) {
        MyQueue queue = new MyQueue();
        queue.push(1);
        System.out.println(queue.pop());
        queue.push(2);
        queue.push(3);
        System.out.println(queue.top());
        System.out.println(queue.pop());
        /*LinkedList<Integer> linkedList = new LinkedList<>();
        linkedList.add(1);
        System.out.println(linkedList.pollFirst());
        System.out.println(linkedList.size());*/
        
    }
}

class MyQueue {
    LinkedList<Integer> linkedList;
    
    public MyQueue() {
        linkedList = new LinkedList<>();
    }
    
    /*
     * @param element: An integer
     * @return: nothing
     */
    public void push(int element) {
        linkedList.push(element);
    }
    
    /*
     * @return: An integer
     */
    public int pop() {
        return linkedList.pollLast();
    }
    
    /*
     * @return: An integer
     */
    public int top() {
        return linkedList.getLast();
    }
}
